package com.xw.controller.admin;


import cn.hutool.db.Page;
import com.xw.entity.ReserveSetting;
import com.xw.service.IReserveSettingService;
import com.xw.vo.ResultVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author y
 * @since 2021-09-15
 */
@RestController
@RequestMapping("/reserveSetting")
public class ReserveSettingController {


    @Autowired
    private IReserveSettingService reserveSettingService;

    /**
     * 添加预约配置
     *
     * @param reserveSetting
     * @return
     */
    @PostMapping("/addReserveSetting")
    public ResultVO addReserveSetting(@RequestBody ReserveSetting reserveSetting) {
        return reserveSettingService.addReserveSetting(reserveSetting);
    }

    /**
     * 修改添加预约配置
     *
     * @param reserveSetting
     * @return
     */
    @PostMapping("/updReserveSetting")
    public ResultVO updReserveSetting(@RequestBody ReserveSetting reserveSetting) {
        return reserveSettingService.updReserveSetting(reserveSetting);
    }

    /**
     * 查询添加预约配置
     *
     * @param recordId
     * @return
     */
    @GetMapping("/findReserveSetting")
    public ResultVO findReserveSetting(@RequestParam("recordId") String recordId) {
        return reserveSettingService.findReserveSetting(recordId);
    }


    /**
     * 配置列表
     */
    @GetMapping("/findReserveSettingList")
    public ResultVO<?> findReserveSettingList(Page page, HttpServletRequest request) {
        return reserveSettingService.findReserveSettingList(page, request);
    }


    /**
     * 删除添加预约配置
     *
     * @param recordId
     * @return
     */
    @DeleteMapping("/delReserveSetting/{recordId}")
    public ResultVO delReserveSetting(@PathVariable("recordId") String recordId) {
        return reserveSettingService.delReserveSetting(recordId);
    }

}

